package ModelLayer;

import java.util.ArrayList;

public class Rent {
	private String id;
	private String dateCreated;
    private String paymentDate;
    private String status;
    private double totalPrice;
    private double amountToPay;
    private double amountPayed;
    private PaymentType paymentType;
    private ArrayList<SalesLine> products;
    private Customer customer;
    private Staff staff;
    private SystemInfo si;
    
    public Rent()
    {
    	id = "";
    	dateCreated = "";
    	paymentDate = "";
    	status = "";
    	totalPrice = 0.0;
    	amountToPay = 0.0;
    	amountPayed = 0.0;
    	paymentType = new PaymentType();
    	products = new ArrayList<SalesLine>();
    	customer = new Customer();
    	staff = new Staff();
    	SystemInfo.getInstance();
    }
    
    public Rent(String _id, String _dateCreated, String _paymentDate, String _status, double _totalPrice, double _amountToPay, double _amountPayed, PaymentType _paymentType, ArrayList<SalesLine> _products, Customer _customer, Staff _staff)
    {
    	id = _id;
    	dateCreated = _dateCreated;
    	paymentDate = _paymentDate;
    	status = _status;
    	totalPrice = _totalPrice;
    	amountToPay = _amountToPay;
    	amountPayed = _amountPayed;
    	paymentType = _paymentType;
    	products = _products;
    	customer = _customer;
    	staff = _staff;
    	SystemInfo.getInstance();
    }
    
    public void setId(String _id)
    {
    	id = _id;
    }
    
    public String getId()
    {
    	return id;
    }
    
    public void setStaff(Staff _staff)
    {
        staff = _staff;
    }
    
    public Staff getStaff()
    {
        return staff;
    }
    
    public void setDateCreated(String _dateCreated)
    {
        dateCreated = _dateCreated;
    }
    
    public String getDateCreated()
    {
        return dateCreated;
    }
    
    public void addProduct(SalesLine _product)
    {
        products.add(_product);
    }
    
    public ArrayList<SalesLine> getAllProducts()
    {
        return products;
    }
    
    public void setTotalPrice(double _totalPrice)
    {
        totalPrice = _totalPrice;
    }
    
    public double getTotalPrice()
    {
        return totalPrice;
    }
    
    public void setPaymentType(PaymentType _paymentType)
    {
        paymentType = _paymentType;
    }
    
    public PaymentType getPaymentType()
    {
        return paymentType;
    }
    
    public void setPaymentDate(String _paymentDate)
    {
        paymentDate = _paymentDate;
    }
    
    public String getPaymentDate()
    {
        return paymentDate;
    }
    
    public void setAmountToPay(double _amountToPay)
    {
        amountToPay = _amountToPay;
    }
    
    public double getAmountToPay()
    {
        return amountToPay;
    }
    
    public void setAmountPayed(double _amountPayed)
    {
        amountPayed = _amountPayed;
    }
    
    public double getAmountPayed()
    {
        return amountPayed;
    }
    
    public void setStatus(String _status)
    {
        status = _status;
    }
    
    public String getStatus()
    {
        return status;
    }
    
    public void setCustomer(Customer _customer)
    {
        customer = _customer;
    }
    
    public Customer getCustomer()
    {
        return customer;
    }
    
    public void removeProduct(String _productId)
    {
        si.setAction(2);
        for(int i = 0; i<products.size(); i++)
        {
            if(products.get(i).getId().equals(_productId))
            {
                products.remove(i);
                si.setError(0);
                return;
            }
        }
        si.setError(1);
    }

	public void calculateTotal() {
		
	}
}
